package csel;

import csel.model.*;
import csel.controller.GameController;
import csel.view.*;

public class RunGame
{
	public static void main(String args[])
	{
		Model model;
		GameController gameController;
		StatusViewport statusView;
		AreaViewport areaView;
		Splasher splashView;
		
		System.out.printf("Working dir: %s\n", System.getProperty("user.dir"));

		model = new Model();

		//We need to create a new game and then create all  the viewports before creating the controller
		try
		{
			GameFactory.newGame(new Summoner(), "default", model);
		}
		catch (java.io.IOException ex)
		{
			javax.swing.JOptionPane.showMessageDialog(null, "Could not load map.");
			return;
		}
		
		statusView = new StatusViewport(model);
		areaView = new AreaViewport(model);
		splashView = new Splasher(model);

		gameController = new GameController(model, splashView, areaView, statusView, false);

		gameController.build(); // the most killer method in the world
		splashView.setVisible(true);
		statusView.setVisible(false);
		areaView.setVisible(false);
	}
}
